// vite.config.js
import vue from '@vitejs/plugin-vue'
import { defineConfig, loadEnv } from 'vite';
import path from 'path';
export default ({ mode }) => {
    const env = loadEnv(mode, process.cwd());
    return defineConfig({
        plugins: [vue()],
        resolve: {
            alias: [
                { find: '@', replacement: path.join(__dirname, './src') },
                // {
                //     find: 'vue',
                //     replacement: 'vue/dist/vue.esm-bundler.js', // compile template
                // },
            ],
        },
        server: {
            hmr: true,
            port: 3070,
            proxy: {
                '/api': {
                    target: env.VITE_BASE_API_URL,
                    rewrite: path => path.replace(/^\/api/, ''),
                    changeOrigin: true,
                },
            },
        },
    })
}